﻿namespace Er.Shared.Models
{
    using System;
    using System.Data.EntityClient;
    using System.Data.Objects;

    using Microsoft.Practices.Unity;

    public class ErLibContainer : ObjectContext, IErLibContainer
    {
        public const string ConnectionString = "name=ErLibContainer";

        public const string ContainerName = "ErLibContainer";

        private IObjectSet<Word> _words;

//        public ErLibContainer(string connectionString = ConnectionString, string defaultContainerName = ContainerName)
//            : base(connectionString, defaultContainerName)
//        {
//        }

        [InjectionConstructor]
        public ErLibContainer()
            : base(ConnectionString, ContainerName)
        {
            this.ContextOptions.LazyLoadingEnabled = true;
        }

        public IObjectSet<Word> Words
        {
            get
            {
                return _words ?? (_words = CreateObjectSet<Word>("Words"));
            }
        }
    }
}